#ifndef SOLID_H_
#define SOLID_H_

#include "model/cube.h"

class Solid{
	protected:
		float dropSpeed;
		Cube size;
	public:
		Solid(const Cube& size){
			this->dropSpeed = 0;
			this->size = size;
		}

		virtual ~Solid(){
		}

		float getDropSpeed(){ return dropSpeed; }

		virtual void accelerate(float accel){
			this->dropSpeed += accel;
		}

		void advanceTime(){
			this->size.translate(0.0f,0.0f,this->dropSpeed);
			this->notifySolidPositionChange(this->dropSpeed);
		}

		void adjust(float dz){
			this->size.translate(0.0f,0.0f,dz);
			this->notifySolidPositionChange(dz);
		}

		virtual void notifyCollided(Solid* obj)=0;
		virtual void notifyCollision(Solid* obj)=0;
		virtual void notifySolidPositionChange(float vel=0)=0;


		Cube& getSize(){ return this->size; }
		void setSize(const Cube& cube){ this->size = cube; }

		bool operator<(const Solid& solid)const{
			return(this->size<solid.size);
		}
};

class PtrSolid{
	private:
		Solid* solid;

	public:
		PtrSolid(Solid* solid){ this->solid=solid; }
		Solid* operator ->(){ return solid; }
		Solid* operator *(){ return solid;  }

		bool operator <(const PtrSolid& ptrSolid)const{
			return (*solid)<(*ptrSolid.solid);
		}

		bool operator ==(const PtrSolid& ptrSolid)const{
			return this->solid==ptrSolid.solid;
		}
};

#endif /* SOLID_H_ */
